High Score
We again will connect to a database on my server to get and set high scores.
- Here is the High Score class, put it in your project. (Here is the api)
- Optional, If you want a test here it is- put it in your project to try it out.
To use it, you will need to create a new HighScore (put it as a global):
HighScore leaderBoard=new HighScore("SomeUniqueID");
Now to get the current leader in your code you might say:
String leader=leaderBoard.getHighScoreName();
Now to get the current high score you might say:
double leaderScore=leaderBoard.getHighScore();
Now to put a score into the leaderBoard. (If you have the name, put that in, otherwise leave out). It will return rank, like 5/8 (Where they scored 5 out of 8).
String rank=leaderBoard.setScore(score,user);
|